package com.diandian.backend.order.param;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.diandian.backend.order.dto.OrderOfflineAddParamDTO;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class OrderOfflineAddParam implements Serializable {

	private String belong; // 客户端所属
	private String offlineOrderNum; // 线下订单号
	private String mobile; // 会员手机号
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date orderTime; // 下单时间
	private String offlineStoreCode; // 下单门店编码
	private String offlineStoreName; // 下单门店名称
	private String payWay; // 支付方式
	private Double payMoney; // 订单金额
	private List<String> onlineOrderNums; // 抖音券id，即验券接口返回的order_id

	public void check(){
		if(offlineOrderNum == null || "".equals(offlineOrderNum)){
			throw new DefaultException("线下订单编码不能为空");
		}
		if(mobile == null || "".equals(mobile)){
			throw new DefaultException("会员手机号不能为空");
		}
		if(orderTime == null){
			orderTime = new Date();
		}
		if(offlineStoreCode == null || "".equals(offlineStoreCode)){
			throw new DefaultException("线下订单核销门店编码不能为空");
		}
		if(offlineStoreName == null || "".equals(offlineStoreName)){
			throw new DefaultException("线下订单核销门店名称不能为空");
		}
		if(payWay == null || "".equals(payWay)){
			throw new DefaultException("线下订单核支付方式不能为空");
		}
		if(payMoney == null){
			throw new DefaultException("线下订单核支付金额不能为空");
		}
		if(onlineOrderNums == null || onlineOrderNums.size() == 0){
			throw new DefaultException("线上订编号不能为空");
		}
		if(belong == null || "".equals(belong)){
			throw new DefaultException("客户端标识不能为空");
		}
	}

	public String getBelong() {
		return belong;
	}

	public void setBelong(String belong) {
		this.belong = belong;
	}

	public String getOfflineOrderNum() {
		return offlineOrderNum;
	}
	public String setOfflineOrderNum(String offlineOrderNum) {
		return this.offlineOrderNum = offlineOrderNum;
	}
	public String getMobile() {
		return mobile;
	}
	public String setMobile(String mobile) {
		return this.mobile = mobile;
	}
	public Date getOrderTime() {
		return orderTime;
	}
	public Date setOrderTime(Date orderTime) {
		return this.orderTime = orderTime;
	}
	public String getOfflineStoreCode() {
		return offlineStoreCode;
	}
	public String setOfflineStoreCode(String offlineStoreCode) {
		return this.offlineStoreCode = offlineStoreCode;
	}
	public String getOfflineStoreName() {
		return offlineStoreName;
	}
	public String setOfflineStoreName(String offlineStoreName) {
		return this.offlineStoreName = offlineStoreName;
	}
	public String getPayWay() {
		return payWay;
	}
	public String setPayWay(String payWay) {
		return this.payWay = payWay;
	}
	public Double getPayMoney() {
		return payMoney;
	}
	public Double setPayMoney(Double payMoney) {
		return this.payMoney = payMoney;
	}
	public List<String> getOnlineOrderNums() {
		return onlineOrderNums;
	}
	public void setOnlineOrderNums(List<String> onlineOrderNums) {
		this.onlineOrderNums = onlineOrderNums;
	}
}
